package day07.test01;

public class Person {
	String name;
	Dog[] dogs;

	public Person() {
		this.dogs = new Dog[3];
	}
	
	public void buyDogs(Market market) {
		Dog[] ds1 = market.dogs;
		Dog[] ds2 = this.dogs;
		for (int i = 0; i < ds2.length; i++) {
			int ran;
			do {
				ran = (int)(Math.random() * ds1.length);
			} while (ds1[ran] == null);
			ds2[i] = ds1[ran];
			ds1[ran] = null;
		}
	}
}
